package es.udc.emarketapp.emarket.model.productFacade.actions;

import java.sql.Connection;

import es.udc.emarketapp.emarket.model.product.dao.SQLProductDAO;
import es.udc.emarketapp.emarket.model.product.dao.SQLProductDAOFactory;

import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.NonTransactionalPlainAction;


public class FindByIdAction implements NonTransactionalPlainAction {

	    private Long idProd;
	    
	    public FindByIdAction(Long idProd) {
	    	this.idProd = idProd;
	    }

	    /**
	     *
	     * @return the <code>ProductVO</code>
	     */
	    public Object execute(Connection connection) 
	        throws InstanceNotFoundException, InternalErrorException {
	                
	        SQLProductDAO productDAO = SQLProductDAOFactory.getDAO();
	            
	        return productDAO.findById(connection, idProd);                        

	    }

	    
	}